<?php

namespace Zilla\StoreBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\ORM\EntityRepository;
use Iptech\PromotionBundle\Form\Type\HistoriquePromotionFormType;
use Symfony\Component\HttpFoundation\File\UploadedFile;

class StoreFormType extends AbstractType
{

    /**
     *
     * @var string
     */
    protected $class;
    

    /**
     *
     * @param string $class 
     */
    function __construct($class)
    {
        $this->class=$class;
        
    }

    /**
     *
     * @param FormBuilderInterface $builder
     * @param array $options 
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {

        $builder
                ->add('title', 'text', array(
                    'required' => true,
                    'max_length' => 150
                ));
    }

    /**
     *
     * @param OptionsResolverInterface $resolver 
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => $this->class,
            'intention'  => 'store',
        ));
    }

    /**
     *
     * @return string
     */
    public function getName()
    {
        return 'store';
    }

}

